<script setup lang="ts" name="Prod">
import { computed } from "vue";
import { RouterLink } from "vue-router";
import { viewRoutes } from "@/router/routes";
import { vPages } from "@/views";

const pNmae = "prod";
const pid = vPages[pNmae].id || 0;
const menu = computed(() => {
  return viewRoutes
    .filter((item) => item?.meta.pid === pid)
    .sort((a, b) => a.meta.order - b.meta.order);
});
</script>

<template>
  <h1>Prod Page</h1>
  <div class="menu-box">
    <router-link
      class="menu-item"
      v-for="(item, index) in menu"
      :key="index"
      :to="item.path"
    >
      {{ item.name }}
    </router-link>
  </div>
  <router-view />
</template>

<style scoped>
.menu-box {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  height: 120px;
}
.menu-item {
  margin: 0 10px;
  font-size: 20px;
  text-decoration: none;
  color: black;
  cursor: pointer;
}
h1 {
  font-size: inherit;
  font-weight: normal;
}
</style>
